package com.system.enterprisemanagementsystem.mapper;

import com.system.enterprisemanagementsystem.pojo.OperateLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OperateLogMapper {



    //插入日志数据
    @Insert("insert into operate_log (operate_emp_id, operate_time, class_name, method_name, method_params, return_value, cost_time) " +
            "values (#{operateEmpId}, #{operateTime}, #{className}, #{methodName}, #{methodParams}, #{returnValue}, #{costTime});")
    void insert(OperateLog log);


//    /**
//     *查询所有数据
//     * @return
//     */
//    @Select("select e.name AS operateEmpName,o.*
//    from operate_log o left join emp e on e.id = o.operate_emp_id  ")
//    List<OperateLog> list();

    /**
     *查询所有数据
     * @return
     */
    @Select("  SELECT" +
            "    ol.*," +
            "    e.name AS operateEmpName" +
            "    FROM operate_log ol" +
            "    LEFT JOIN emp e ON ol.operate_emp_id = e.id")
    List<OperateLog> list();



}
